﻿$(function () {
    var qcloud = {};
    $('[_t_nav]').hover(function () {
        var _nav = $(this).attr('_t_nav');
        clearTimeout(qcloud[_nav + '_timer']);
        qcloud[_nav + '_timer'] = setTimeout(function () {
            $('#' + _nav).stop(true, true).fadeIn(100);
        }, 0);
    },
    function () {
        var _nav = $(this).attr('_t_nav');
        clearTimeout(qcloud[_nav + '_timer']);
        qcloud[_nav + '_timer'] = setTimeout(function () {
            $('#' + _nav).stop(true, true).fadeOut(0);
        }, 100);
    });
    /*跳转*/
    var goTop = $('.gotop');
    goTop.fadeOut();
    $(window, document).scroll(function () {
        $(this).scrollTop() > 100 ? goTop.fadeIn() : goTop.fadeOut();
    });
    /*
    * 初始化按钮的loading功能，点击后将显示Loading字样，并且按钮被disabled掉，无法连续点击，防止二次提交
    * 超过3秒后按钮将恢复原状
    */
    $('button[data-loading-text]').click(function () {
        var btn = $(this).button('loading');
        setTimeout(function () {
            btn.button('reset');
        }, 3000);
    });
    
    //<!-- begin 给id=json_input的textarea增加行号 -->
    $("#json_input").setTextareaCount({
    	width: "50px",
    	//bgColor: "#99CCCC",
    	color: "#9eacb4",
    	display: "inline-block"
    });
    //<!-- end 给id=json_input的textarea增加行号 -->
    
    
  //<!-- begin 给id=json-src的textarea增加行号 -->
    $("#json-src").setTextareaCount({
    	width: "50px",
    	//bgColor: "#99CCCC",
    	color: "#9eacb4",
    	display: "inline-block"
    });
    //<!-- end 给id=json-src的textarea增加行号 -->
    
});
// 定义一个新的复制对象
var clip = new ZeroClipboard($("#copyallcode"), {
    moviePath: "/them/1/img/ZeroClipboard.swf"
});


// 复制内容到剪贴板成功后的操作
clip.on('complete', function (client, args) {
    var brdge = $("#global-zeroclipboard-html-bridge");
    brdge.attr("title", "复制成功！").tooltip("fixTitle").tooltip("show").attr("title", "复制到剪贴板").tooltip("fixTitle");
});
console.log('%c整理点东西，把自己日常遇到的解决方案分享给大家~@~\n%c'+www+'\n-------------\nQQ技术交流群: 157906825 ，赶快加群吧', 'color:#66be8c; font-size: 21px;', 'color:#66be8c');


(function(q) {
	q.w = window;
	q.d = document;
	q.w.so = q;
	q.Utils = {
		contains: function() {
			var resource = arguments[0];
			for (var i = 1; i < arguments.length; i++) {
				var element = arguments[i];
				if (resource.indexOf(element) != -1) {
					return ! 0
				}
			}
			return ! 1
		}
	},
	q.nowUrl = function() {
		return window.location.href
	},
	q.refresh = function(url, time) {
		time = time || 0;
		setTimeout(function() {
			window.location.href = url || this.nowUrl()
		},
		(parseInt(time) * 1000))
	},
	q.msg = function() {
		var a = ['箭头们，上点东西吧，表让我为难哦！', '次奥，介里不能为空哒', '啥也木有，然并卵，，，。。。', 'Young, there\'s nothing here ！', '你又淘气了，先来个字符串吧！', '当山峰没有棱角的时候，当河水不再流...'],
		r = parseInt(Math.random() * 10),
		r = r > 4 ? r - 4 : r;
		return a[r] || 'I don\'t know what to say you are!'
	},
	q.defn = function() {},
	q.loadFile = function(array, time, fn) {
		setTimeout(function() {
			var _0 = q.nowUrl().split('.com')[0].replace('www', 'cdn') + '.com/';
			$(array).each(function() {
				var head = document.getElementsByTagName('head')[0],
				script = document.createElement('script');
				script.type = 'text/javascript';
				script.src = _0 + this;
				head.appendChild(script)
			}),
			fn && fn()
		},
		time || 1000)
	},
	q.se = function() {
		var A = "www",
		q = ".",
		s4 = "it",
		x8 = "json",
		b = s4 + x8,
		h = "com";
		var x = A + q + b + q + h;
		if ((document.domain + "").search(x) !== 0) {
			$(so.d).empty();
			q = null,
			so = null;
			for (1; 1;) location.href = location.href;
			return ! 1
		}
	}
})(jQuery);
